package day11.file;

import java.io.File;

/**
 * @author Xiao
 * @date 2021/7/31
 */
public class FileDemo01 {
    /**
     * 使用File(String pathName)创建对象
     * 使用File(String parent,String child)创建对象
     * 使用File(File parent,String child)创建对象
     */
    public static void main(String[] args) {
        String path = "E:\\develop\\practice\\HelloWorld.java";
        File file1 = new File(path);
        System.out.println(file1);
        System.out.println("--------------");
        //为什么要把字符串转成File：为了使用File中的方法
        String path1 = "E:\\develop\\practice";
        String path2 = "HelloWorld.java";
        File file2 = new File(path1, path2);
        System.out.println(file2);
        System.out.println("--------------");
        File file = new File("E:\\develop\\practice");
        String path3 = "HelloWorld.java";
        File file3 = new File(file, path3);
        System.out.println(file3);
    }
}
